home *** CD-ROM | disk | FTP | other *** search
- #ifndef __NTTP__
- #define __NNTP__
-
- #include "net.h"
-
- #define nntpServerErr 130
- #define nntpNoSuchGroupErr 131
- #define nntpNoSuchArticleErr 132
- #define nntpAuthFailedErr 133
-
- typedef void *NntpStreamRef;
- typedef OSErr (*NntpGiveTimeFunction) (void);
-
- typedef struct NntpStreamOptions {
- short idleTime; /* stream is automatically closed if idle for this
- many minutes, or 0 to disable */
- Boolean useXPAT; /* true to use XPAT command for searches */
- Boolean sendModeReader; /* true to send MODE READER command after connect */
- Boolean batchedCmds; /* true to use batched GROUP commands */
- Boolean newConnection; /* true to establish new connection before getting
- group info */
- Boolean authOnConnect; /* true to authorize on each new connection */
- char username[32]; /* authorization username */
- char password[32]; /* authorization password */
- } NntpStreamOptions;
-
- typedef struct NntpGroupInfo {
- long offset; /* offset into strings of group name */
- long first; /* first article number in group */
- long last; /* last article number in group */
- long count; /* estimate of number of articles in group */
- char status; /* group status, lower case */
- Boolean ok; /* true if no error when getting group info */
- } NntpGroupInfo, *NntpGroupInfoPtr, **NntpGroupInfoHandle;
-
- typedef struct NntpHeaderInfo {
- long number; /* article number */
- long offset; /* offset into strings of header contents */
- } NntpHeaderInfo, *NntpHeaderInfoPtr, **NntpHeaderInfoHandle;
-
- void NntpInit (NntpGiveTimeFunction giveTime);
- OSErr NntpIdle (void);
-
- OSErr NntpOpen (char *host, NntpStreamOptions *options, NntpStreamRef *stream);
- OSErr NntpClose (NntpStreamRef stream);
- OSErr NntpAbort (NntpStreamRef stream);
- OSErr NntpSetStreamOptions (NntpStreamRef stream, NntpStreamOptions *options);
- OSErr NntpGetGroupNames (NntpStreamRef stream, unsigned long time,
- char *statusFilter, Handle *strings, long *numGroups);
- OSErr NntpGetGroupInfo (NntpStreamRef stream, char *group,
- long *first, long *last, long *count);
- OSErr NntpGetMultipleGroupInfo (NntpStreamRef stream, NntpGroupInfoHandle info,
- long numGroups, Handle strings);
- OSErr NntpGetHeaders (NntpStreamRef stream, char *group, long first, long last,
- char *header, char *pattern,
- void (*buildXPAT)(char *pattern, char *regExp, short regExpLen),
- Boolean (*matchPattern)(char *pattern, char *string),
- NntpHeaderInfoHandle *info, Handle *strings, long *numHeaders);
- OSErr NntpGetArticle (NntpStreamRef stream, char *group, long number,
- char *id, char *part, Handle *text, NetChunkFunction chunkFunction,
- Ptr userDataPtr);
- OSErr NntpPostArticle (NntpStreamRef stream, Handle text, Boolean *postIndeterminate);
- OSErr NntpAuthorize (NntpStreamRef stream);
- OSErr NntpGetHello (NntpStreamRef stream, CStr255 msg);
- OSErr NntpGetHelp (NntpStreamRef stream, Handle *text);
- OSErr NntpGetIPAddr (NntpStreamRef stream, unsigned long *ipAddr);
- void NntpGetServerErrInfo (NntpStreamRef stream, NetServerErrInfo *serverErrInfo);
-
- #endif
-